package com.atguigu05._super;

public class Student extends Person {
    private String school;
    int id=2;
    public void study(){
        System.out.println("studying");
    }

    public void eat(){
        System.out.println("student eating");
    }
    public void Sleep(){
        System.out.println("student sleeping");
    }

    public void show(){
        super.Sleep();
    }

    public void show2(){   //当父类和子类都有id属性的时候不加this选择就近原则
        System.out.println(id);
    }

    public void show3(){   //只有父类中有name，三种写法等价
        System.out.println(name);
        System.out.println(this.name);
        System.out.println(super.name);
    }
    //测试super调用父类的构造器
    //如果在子类构造器的首行既没有显示调用"this(形参列表)"，也没有显式调用"super(形参列表)",
    //则子类此构造器默认调用""super()"，即调用父类中空参的构造器。
    public Student(){
       // super();
    }

    public static class exstudent extends Student {

    }
}
